from enum import Enum


# 6种断言方式
class AssertType(Enum):
    JSON_FULL_TEXT = '检查点-json全文'
    GTE_AMOUNT = '检查点-数据条数大于等于'
    EQUAL_AMOUNT = '检查点-数据条数等于'
    CONTAIN_FIELDS = '检查点-包含指定字段的值'
    EQUAL_FIELD = '检查点-等于指定字段的值'
    SQL_RESULT = '检查点-sql执行结果'


# 常见的5种请求类型
class RequestType(Enum):
    QUERY_STRING = 'query_string'
    PATH_PARAMETER = 'path_parameter'
    FORM = 'form'
    JSON = 'json'
    FILE = 'file'


# 接口信息
class ApiInfo(Enum):
    DESCRIBE = 'describe'
    URL = 'url'
    METHOD = 'method'
    REQUEST_TYPE = 'request_type'
    HEADERS = 'headers'
    TIMESTAMP = 'timestamp'
    CONTENT_TYPE = 'Content-Type'
    TEST_DATA_FILE_PATH = 'testDataFilePath'
    ASSERT_INFO = 'assert_info'
    JSON_FULL_TEXT_IGNORE_FIELD = 'json_full_text_ignore_field'
    LIST_JSON_PATH = 'list_json_path'
    CONTAIN_FIELDS_JSON_PATH = 'contain_fields_json_path'
    EQUAL_FIELD_JSON_PATH = 'equal_field_json_path'
    DB_NAME = 'db_name'
    HOST = 'host'
    COOKIE = 'cookie'
    USER_AGENT = 'User-Agent'


# excel表头字段
class ExcelHead(Enum):
    DESCRIBE = '用例说明'
    AUTHOR = '作者'
    ID = '序号'
    SKIP = 'skip'
    REQUEST_PARAMS = '请求参数'
    SQL = 'sql语句'
    UPLOAD_FILE = '上传文件'
    CHECK_POINT = '检查点'


# 上传文件接口，需要在excel中填写的三个字段
class UploadApiField(Enum):
    FILE_PATH = '上传文件-filePath'
    FILE_TYPE = '上传文件-fileType'
    PARAMS_TYPE = '上传文件-paramsType'


# 上传文件接口，传递额外参数的类型
class ParamsType(Enum):
    QUERY_STRING = 'query_string'
    FORM = 'form'
    JSON = 'json'


# 通用错误提示信息
class CommonErrorInfo(Enum):
    PROJECT_NAME_NOT_EXISTS = 'project_name不存在'
    PROJECT_NAME_IS_NONE = 'project_name为空'
    API_NAME_NOT_EXISTS = 'api_name不存在'
    API_NAME_IS_NONE = 'api_name为空'
    API_FILE_PATH_IS_NONE = '接口定义文件路径为空'
    API_COMMON_INFO_FILE_PATH_IS_NONE = '接口公共信息文件路径为空'
    SEPARATOR_IS_WRONG = '文件路径分隔符错误'
    FILE_PATH_IS_NONE = '文件路径为空'
    NUM_OF_PROCESS_IS_WRONG = '请输入正确的进程数（大于等于1）'
    RESPONSE_OR_JSONPATH_IS_NONE = '接口响应值或jsonpath为空'


# YamlHandler类的错误提示信息
class YamlHandlerErrorInfo(Enum):
    HOST_OR_COOKIE_IS_NONE = 'host或cookie为空'
    API_COMMON_INFO_IS_NONE = '接口公共信息为空'


# ExcelHandler类的错误提示信息
class ExcelHandlerErrorInfo(Enum):
    NO_TEST_DATA = '无测试数据'
    NO_NECESSARY_EXCEL_HEAD = '缺少必要的表头'
    NO_TEST_DATA_FILE_PATH = '缺少测试数据文件路径'


# RequestHandler类的错误提示信息
class RequestHandlerErrorInfo(Enum):
    REQUEST_TYPE_IS_NONE = 'RequestType为空'
    HOST_IS_NONE = 'host为空'
    URL_IS_NONE = 'url为空'
    METHOD_IS_NONE = 'method为空'
    HEADERS_IS_NONE = 'headers为空'
    REQUEST_TYPE_IS_WRONG = '请求类型错误'


# AssertHandler类的提示信息
class AssertHandlerInfo(Enum):
    ONLY_SUPPORT_ONE_FIELD = '只支持一个指定字段'
    JSON_FULL_TEXT_FAIL = 'json全文校验未通过 ！！！'
    JSON_FULL_TEXT_PASS = '***** json全文检验通过 *****'
    GTE_AMOUNT_FAIL = '数据条数大于等于预期结果校验未通过 ！！！'
    GTE_AMOUNT_PASS = '***** 数据条数大于等于预期结果校验通过 *****'
    EQUAL_AMOUNT_FAIL = '数据条数等于预期结果校验未通过 ！！！'
    EQUAL_AMOUNT_PASS = '***** 数据条数等于预期结果校验通过 *****'
    CONTAIN_FIELDS_FAIL = '包含指定字段的值校验未通过 ！！！'
    CONTAIN_FIELDS_PASS = '***** 包含指定字段的值校验通过 *****'
    EQUAL_FIELD_FAIL = '等于指定字段的值校验未通过 ！！！'
    EQUAL_FIELD_PASS = '***** 等于指定字段的值通过 *****'
    EXPECTED_VALUE_IS_NONE = '预期值为空'
    DB_NAME_IS_NONE = '数据库名称为空'
    DB_NAME_NOT_EXIST = '数据库名称不存在'
    SQL_IS_NONE = 'sql语句为空'
    SQL_RESULT_PASS = 'sql执行结果校验通过'
    SQL_RESULT_FAIl = 'sql执行结果校验未通过'
    COMMA_NOT_EXIST = '未使用逗号分隔jsonpath和要提取的字段'


# 通用信息
class CommonInfo(Enum):
    EXCEL_ROW_INFO = '数据信息'
    SHEET_NAME = '测试数据'
    PLACEHOLDER = '@'
    USER_AGENT_VALUE = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) ' \
                       'Chrome/127.0.0.0 Safari/537.36'


# 数据库连接信息
class MysqlConnectInfo(Enum):
    HOST = 'host'
    PORT = 'port'
    USER = 'user'
    PASSWORD = 'password'
    DATABASE = 'database'
